package com.lagou.task18;

public class ThreadIdNameTest extends Thread {

    public ThreadIdNameTest(String guanyu) {
        super(guanyu);
    }

    @Override
    public void run() {
        System.out.println("子线程的编号= " + getId() + " 名字=" + getName());
        setName("zhangfei");
        System.out.println("子线程的编号= " + getId() + " 名字=" + getName());
    }

    public static void main(String[] args) {
        Thread t1 = new ThreadIdNameTest("guanyu");
        t1.start();
        System.out.println("主线成的id=" + currentThread().getId());
    }
}
